home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 April: Mac OS SDK / Dev.CD Apr 99 SDK1.toast / Development Kits / Interfaces&Libraries / Universal / Interfaces / PInterfaces / QD3D.p < prev    next >
Encoding:
Text File  |  1998-08-17  |  32.7 KB  |  1,007 lines  |  [TEXT/MPS ]

  1. {
  2.      File:        QD3D.p
  3.  
  4.      Contains:    Base types for Quickdraw 3D                            
  5.  
  6.      Version:    Technology:    Quickdraw 3D 1.5.4
  7.                  Release:    Universal Interfaces 3.2
  8.  
  9.      Copyright:    © 1995-1998 by Apple Computer, Inc., all rights reserved.
  10.  
  11.      Bugs?:        For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. }
  17. {$IFC UNDEFINED UsingIncludes}
  18. {$SETC UsingIncludes := 0}
  19. {$ENDC}
  20.  
  21. {$IFC NOT UsingIncludes}
  22.  UNIT QD3D;
  23.  INTERFACE
  24. {$ENDC}
  25.  
  26. {$IFC UNDEFINED __QD3D__}
  27. {$SETC __QD3D__ := 1}
  28.  
  29. {$I+}
  30. {$SETC QD3DIncludes := UsingIncludes}
  31. {$SETC UsingIncludes := 1}
  32.  
  33. {$IFC UNDEFINED __CONDITIONALMACROS__}
  34. {$I ConditionalMacros.p}
  35. {$ENDC}
  36.  
  37. {$IFC TARGET_OS_MAC }
  38. {$IFC UNDEFINED __MACTYPES__}
  39. {$I MacTypes.p}
  40. {$ENDC}
  41. {$ENDC}  {TARGET_OS_MAC}
  42.  
  43.  
  44. {$PUSH}
  45. {$ALIGN POWER}
  46. {$LibExport+}
  47.  
  48. {$IFC TARGET_OS_MAC }
  49. {$SETC OS_MACINTOSH := 1 }
  50. {$SETC OS_WIN32 := 0 }
  51. {$SETC OS_UNIX := 0 }
  52. {$SETC OS_NEXT := 0 }
  53. {$SETC WINDOW_SYSTEM_MACINTOSH := 1 }
  54. {$SETC WINDOW_SYSTEM_WIN32 := 0 }
  55. {$SETC WINDOW_SYSTEM_X11 := 0 }
  56. {$SETC WINDOW_SYSTEM_NEXT := 0 }
  57. {$ENDC}  {TARGET_OS_MAC}
  58.  
  59.  
  60. {*****************************************************************************
  61.  **                                                                             **
  62.  **                                NULL definition                                 **
  63.  **                                                                             **
  64.  ****************************************************************************}
  65. {*****************************************************************************
  66.  **                                                                             **
  67.  **                                    Objects                                     **
  68.  **                                                                             **
  69.  ****************************************************************************}
  70. {
  71.  * Everything in QuickDraw 3D is an OBJECT: a bunch of data with a type,
  72.  * deletion, duplication, and i/o methods.
  73.  }
  74.  
  75. TYPE
  76.     TQ3ObjectType                        = LONGINT;
  77.     TQ3ObjectTypePtr                    = ^TQ3ObjectType;
  78.     TQ3Object = ^LONGINT;
  79. {   }
  80. {
  81.  * There are four subclasses of OBJECT:
  82.  *    an ELEMENT, which is data that is placed in a SET
  83.  *    a SHAREDOBJECT, which is reference-counted data that is shared
  84.  *    VIEWs, which maintain state information for an image
  85.  *    a PICK, which used to query a VIEW
  86.  }
  87.     TQ3ElementObject                    = TQ3Object;
  88.     TQ3SharedObject                        = TQ3Object;
  89.     TQ3ViewObject                        = TQ3Object;
  90.     TQ3PickObject                        = TQ3Object;
  91. {
  92.  * There are several types of SharedObjects:
  93.  *    RENDERERs, which paint to a drawContext
  94.  *    DRAWCONTEXTs, which are an interface to a device 
  95.  *    SETs, which maintains "mathematical sets" of ELEMENTs
  96.  *    FILEs, which maintain state information for a metafile
  97.  *    SHAPEs, which affect the state of the View
  98.  *    SHAPEPARTs, which contain geometry-specific data about a picking hit
  99.  *    CONTROLLERSTATEs, which hold state of the output channels for a CONTROLLER
  100.  *    TRACKERs, which represent a position and orientation in the user interface
  101.  *  STRINGs, which are abstractions of text string data.
  102.  *    STORAGE, which is an abstraction for stream-based data storage (files, memory)
  103.  *    TEXTUREs, for sharing bitmap information for TEXTURESHADERS
  104.  *    VIEWHINTs, which specifies viewing preferences in FILEs
  105.  }
  106.     TQ3RendererObject                    = TQ3SharedObject;
  107.     TQ3DrawContextObject                = TQ3SharedObject;
  108.     TQ3SetObject                        = TQ3SharedObject;
  109.     TQ3FileObject                        = TQ3SharedObject;
  110.     TQ3ShapeObject                        = TQ3SharedObject;
  111.     TQ3ShapePartObject                    = TQ3SharedObject;
  112.     TQ3ControllerStateObject            = TQ3SharedObject;
  113.     TQ3TrackerObject                    = TQ3SharedObject;
  114.     TQ3StringObject                        = TQ3SharedObject;
  115.     TQ3StorageObject                    = TQ3SharedObject;
  116.     TQ3TextureObject                    = TQ3SharedObject;
  117.     TQ3ViewHintsObject                    = TQ3SharedObject;
  118. {
  119.  * There is one types of SET:
  120.  *    ATTRIBUTESETs, which contain ATTRIBUTEs which are inherited 
  121.  }
  122.     TQ3AttributeSet                        = TQ3SetObject;
  123.     TQ3AttributeSetPtr                    = ^TQ3AttributeSet;
  124. {
  125.  * There are many types of SHAPEs:
  126.  *    LIGHTs, which affect how the RENDERER draws 3-D cues
  127.  *    CAMERAs, which affects the location and orientation of the RENDERER in space
  128.  *    GROUPs, which may contain any number of SHARED OBJECTS
  129.  *    GEOMETRYs, which are representations of three-dimensional data
  130.  *    SHADERs, which affect how colors are drawn on a geometry
  131.  *    STYLEs, which affect how the RENDERER paints to the DRAWCONTEXT
  132.  *    TRANSFORMs, which affect the coordinate system in the VIEW
  133.  *    REFERENCEs, which are references to objects in FILEs
  134.  *  UNKNOWN, which hold unknown objects read from a metafile.
  135.  }
  136.     TQ3GroupObject                        = TQ3ShapeObject;
  137.     TQ3GeometryObject                    = TQ3ShapeObject;
  138.     TQ3ShaderObject                        = TQ3ShapeObject;
  139.     TQ3StyleObject                        = TQ3ShapeObject;
  140.     TQ3TransformObject                    = TQ3ShapeObject;
  141.     TQ3LightObject                        = TQ3ShapeObject;
  142.     TQ3CameraObject                        = TQ3ShapeObject;
  143.     TQ3UnknownObject                    = TQ3ShapeObject;
  144.     TQ3ReferenceObject                    = TQ3ShapeObject;
  145. {
  146.  * For now, there is only one type of SHAPEPARTs:
  147.  *    MESHPARTs, which describe some part of a mesh
  148.  }
  149.     TQ3MeshPartObject                    = TQ3ShapePartObject;
  150. {
  151.  * There are three types of MESHPARTs:
  152.  *    MESHFACEPARTs, which describe a face of a mesh
  153.  *    MESHEDGEPARTs, which describe a edge of a mesh
  154.  *    MESHVERTEXPARTs, which describe a vertex of a mesh
  155.  }
  156.     TQ3MeshFacePartObject                = TQ3MeshPartObject;
  157.     TQ3MeshEdgePartObject                = TQ3MeshPartObject;
  158.     TQ3MeshVertexPartObject                = TQ3MeshPartObject;
  159. {
  160.  * A DISPLAY Group can be drawn to a view
  161.  }
  162.     TQ3DisplayGroupObject                = TQ3GroupObject;
  163. {
  164.  * There are many types of SHADERs:
  165.  *    SURFACESHADERs, which affect how the surface of a geometry is painted
  166.  *    ILLUMINATIONSHADERs, which affect how lights affect the color of a surface
  167.  }
  168.     TQ3SurfaceShaderObject                = TQ3ShaderObject;
  169.     TQ3IlluminationShaderObject            = TQ3ShaderObject;
  170. {
  171.  * A handle to an object in a group
  172.  }
  173.     TQ3GroupPosition = ^LONGINT;
  174.     TQ3GroupPositionPtr                    = ^TQ3GroupPosition;
  175.  * TQ3ObjectClassNameString is used for the class name of an object
  176.  }
  177.  
  178. CONST
  179.     kQ3StringMaximumLength        = 1024;
  180.  
  181.  
  182. TYPE
  183.     TQ3ObjectClassNameString            = PACKED ARRAY [0..1023] OF CHAR;
  184. {*****************************************************************************
  185.  **                                                                             **
  186.  **                            Client/Server Things                             **
  187.  **                                                                             **
  188.  ****************************************************************************}
  189.     TQ3ControllerRef                    = Ptr;
  190. {*****************************************************************************
  191.  **                                                                             **
  192.  **                            Flags and Switches                                 **
  193.  **                                                                             **
  194.  ****************************************************************************}
  195.     TQ3Boolean                     = LONGINT;
  196. CONST
  197.     kQ3False                    = {TQ3Boolean}0;
  198.     kQ3True                        = {TQ3Boolean}1;
  199.  
  200.  
  201. TYPE
  202.     TQ3Switch                     = LONGINT;
  203. CONST
  204.     kQ3Off                        = {TQ3Switch}0;
  205.     kQ3On                        = {TQ3Switch}1;
  206.  
  207.  
  208. TYPE
  209.     TQ3Status                     = LONGINT;
  210. CONST
  211.     kQ3Failure                    = {TQ3Status}0;
  212.     kQ3Success                    = {TQ3Status}1;
  213.  
  214.  
  215. TYPE
  216.     TQ3Axis                     = LONGINT;
  217. CONST
  218.     kQ3AxisX                    = {TQ3Axis}0;
  219.     kQ3AxisY                    = {TQ3Axis}1;
  220.     kQ3AxisZ                    = {TQ3Axis}2;
  221.  
  222.  
  223. TYPE
  224.     TQ3PixelType                 = LONGINT;
  225. CONST
  226.     kQ3PixelTypeRGB32            = {TQ3PixelType}0;                {  Alpha:8 (ignored), R:8, G:8, B:8     }
  227.     kQ3PixelTypeARGB32            = {TQ3PixelType}1;                {  Alpha:8, R:8, G:8, B:8              }
  228.     kQ3PixelTypeRGB16            = {TQ3PixelType}2;                {  Alpha:1 (ignored), R:5, G:5, B:5     }
  229.     kQ3PixelTypeARGB16            = {TQ3PixelType}3;                {  Alpha:1, R:5, G:5, B:5              }
  230.     kQ3PixelTypeRGB16_565        = {TQ3PixelType}4;                {  Win32 only: 16 bits/pixel, R:5, G:6, B:5         }
  231.     kQ3PixelTypeRGB24            = {TQ3PixelType}5;                {  Win32 only: 24 bits/pixel, R:8, G:8, B:8         }
  232.  
  233.  
  234. TYPE
  235.     TQ3Endian                     = LONGINT;
  236. CONST
  237.     kQ3EndianBig                = {TQ3Endian}0;
  238.     kQ3EndianLittle                = {TQ3Endian}1;
  239.  
  240.  
  241. TYPE
  242.     TQ3EndCapMasks                 = LONGINT;
  243. CONST
  244.     kQ3EndCapNone                = {TQ3EndCapMasks}0;
  245.     kQ3EndCapMaskTop            = {TQ3EndCapMasks}$01;
  246.     kQ3EndCapMaskBottom            = {TQ3EndCapMasks}$02;
  247.     kQ3EndCapMaskInterior        = {TQ3EndCapMasks}$04;
  248.  
  249.  
  250. TYPE
  251.     TQ3EndCap                            = UInt32;
  252.  
  253. CONST
  254.     kQ3ArrayIndexNULL            = -1;
  255.  
  256. {*****************************************************************************
  257.  **                                                                             **
  258.  **                        Point and Vector Definitions                         **
  259.  **                                                                             **
  260.  ****************************************************************************}
  261.  
  262. TYPE
  263.     TQ3Vector2DPtr = ^TQ3Vector2D;
  264.     TQ3Vector2D = RECORD
  265.         x:                        Single;
  266.         y:                        Single;
  267.     END;
  268.  
  269.     TQ3Vector3DPtr = ^TQ3Vector3D;
  270.     TQ3Vector3D = RECORD
  271.         x:                        Single;
  272.         y:                        Single;
  273.         z:                        Single;
  274.     END;
  275.  
  276.     TQ3Point2DPtr = ^TQ3Point2D;
  277.     TQ3Point2D = RECORD
  278.         x:                        Single;
  279.         y:                        Single;
  280.     END;
  281.  
  282.     TQ3Point3DPtr = ^TQ3Point3D;
  283.     TQ3Point3D = RECORD
  284.         x:                        Single;
  285.         y:                        Single;
  286.         z:                        Single;
  287.     END;
  288.  
  289.     TQ3RationalPoint4DPtr = ^TQ3RationalPoint4D;
  290.     TQ3RationalPoint4D = RECORD
  291.         x:                        Single;
  292.         y:                        Single;
  293.         z:                        Single;
  294.         w:                        Single;
  295.     END;
  296.  
  297.     TQ3RationalPoint3DPtr = ^TQ3RationalPoint3D;
  298.     TQ3RationalPoint3D = RECORD
  299.         x:                        Single;
  300.         y:                        Single;
  301.         w:                        Single;
  302.     END;
  303.  
  304. {*****************************************************************************
  305.  **                                                                             **
  306.  **                                Quaternion                                     **
  307.  **                                                                             **
  308.  ****************************************************************************}
  309.     TQ3QuaternionPtr = ^TQ3Quaternion;
  310.     TQ3Quaternion = RECORD
  311.         w:                        Single;
  312.         x:                        Single;
  313.         y:                        Single;
  314.         z:                        Single;
  315.     END;
  316.  
  317. {*****************************************************************************
  318.  **                                                                             **
  319.  **                                Ray Definition                                 **
  320.  **                                                                             **
  321.  ****************************************************************************}
  322.     TQ3Ray3DPtr = ^TQ3Ray3D;
  323.     TQ3Ray3D = RECORD
  324.         origin:                    TQ3Point3D;
  325.         direction:                TQ3Vector3D;
  326.     END;
  327.  
  328. {*****************************************************************************
  329.  **                                                                             **
  330.  **                        Parameterization Data Structures                     **
  331.  **                                                                             **
  332.  ****************************************************************************}
  333.     TQ3Param2DPtr = ^TQ3Param2D;
  334.     TQ3Param2D = RECORD
  335.         u:                        Single;
  336.         v:                        Single;
  337.     END;
  338.  
  339.     TQ3Param3DPtr = ^TQ3Param3D;
  340.     TQ3Param3D = RECORD
  341.         u:                        Single;
  342.         v:                        Single;
  343.         w:                        Single;
  344.     END;
  345.  
  346.     TQ3Tangent2DPtr = ^TQ3Tangent2D;
  347.     TQ3Tangent2D = RECORD
  348.         uTangent:                TQ3Vector3D;
  349.         vTangent:                TQ3Vector3D;
  350.     END;
  351.  
  352.     TQ3Tangent3DPtr = ^TQ3Tangent3D;
  353.     TQ3Tangent3D = RECORD
  354.         uTangent:                TQ3Vector3D;
  355.         vTangent:                TQ3Vector3D;
  356.         wTangent:                TQ3Vector3D;
  357.     END;
  358.  
  359. {*****************************************************************************
  360.  **                                                                             **
  361.  **                        Polar and Spherical Coordinates                         **
  362.  **                                                                             **
  363.  ****************************************************************************}
  364.     TQ3PolarPointPtr = ^TQ3PolarPoint;
  365.     TQ3PolarPoint = RECORD
  366.         r:                        Single;
  367.         theta:                    Single;
  368.     END;
  369.  
  370.     TQ3SphericalPointPtr = ^TQ3SphericalPoint;
  371.     TQ3SphericalPoint = RECORD
  372.         rho:                    Single;
  373.         theta:                    Single;
  374.         phi:                    Single;
  375.     END;
  376.  
  377. {*****************************************************************************
  378.  **                                                                             **
  379.  **                            Color Definition                                 **
  380.  **                                                                             **
  381.  ****************************************************************************}
  382.     TQ3ColorRGBPtr = ^TQ3ColorRGB;
  383.     TQ3ColorRGB = RECORD
  384.         r:                        Single;
  385.         g:                        Single;
  386.         b:                        Single;
  387.     END;
  388.  
  389.     TQ3ColorARGBPtr = ^TQ3ColorARGB;
  390.     TQ3ColorARGB = RECORD
  391.         a:                        Single;
  392.         r:                        Single;
  393.         g:                        Single;
  394.         b:                        Single;
  395.     END;
  396.  
  397. {*****************************************************************************
  398.  **                                                                             **
  399.  **                                    Vertices                                 **
  400.  **                                                                             **
  401.  ****************************************************************************}
  402.     TQ3Vertex3DPtr = ^TQ3Vertex3D;
  403.     TQ3Vertex3D = RECORD
  404.         point:                    TQ3Point3D;
  405.         attributeSet:            TQ3AttributeSet;
  406.     END;
  407.  
  408. {*****************************************************************************
  409.  **                                                                             **
  410.  **                                    Matrices                                 **
  411.  **                                                                             **
  412.  ****************************************************************************}
  413.     TQ3Matrix3x3Ptr = ^TQ3Matrix3x3;
  414.     TQ3Matrix3x3 = RECORD
  415.         value:                    ARRAY [0..2,0..2] OF Single;
  416.     END;
  417.  
  418.     TQ3Matrix4x4Ptr = ^TQ3Matrix4x4;
  419.     TQ3Matrix4x4 = RECORD
  420.         value:                    ARRAY [0..3,0..3] OF Single;
  421.     END;
  422.  
  423. {*****************************************************************************
  424.  **                                                                             **
  425.  **                                Bitmap/Pixmap                                 **
  426.  **                                                                             **
  427.  ****************************************************************************}
  428.     TQ3PixmapPtr = ^TQ3Pixmap;
  429.     TQ3Pixmap = RECORD
  430.         image:                    Ptr;
  431.         width:                    UInt32;
  432.         height:                    UInt32;
  433.         rowBytes:                UInt32;
  434.         pixelSize:                UInt32;                                    {  MUST be 16 or 32 to use with the    Interactive Renderer on Mac OS }
  435.         pixelType:                TQ3PixelType;
  436.         bitOrder:                TQ3Endian;
  437.         byteOrder:                TQ3Endian;
  438.     END;
  439.  
  440.     TQ3StoragePixmapPtr = ^TQ3StoragePixmap;
  441.     TQ3StoragePixmap = RECORD
  442.         image:                    TQ3StorageObject;
  443.         width:                    UInt32;
  444.         height:                    UInt32;
  445.         rowBytes:                UInt32;
  446.         pixelSize:                UInt32;                                    {  MUST be 16 or 32 to use with the    Interactive Renderer on Mac OS }
  447.         pixelType:                TQ3PixelType;
  448.         bitOrder:                TQ3Endian;
  449.         byteOrder:                TQ3Endian;
  450.     END;
  451.  
  452.     TQ3BitmapPtr = ^TQ3Bitmap;
  453.     TQ3Bitmap = RECORD
  454.         image:                    Ptr;
  455.         width:                    UInt32;
  456.         height:                    UInt32;
  457.         rowBytes:                UInt32;
  458.         bitOrder:                TQ3Endian;
  459.     END;
  460.  
  461.     TQ3MipmapImagePtr = ^TQ3MipmapImage;
  462.     TQ3MipmapImage = RECORD
  463.                                                                         {  An image for use as a texture mipmap   }
  464.         width:                    UInt32;                                    {  Width of mipmap, must be power of 2    }
  465.         height:                    UInt32;                                    {  Height of mipmap, must be power of 2   }
  466.         rowBytes:                UInt32;                                    {  Rowbytes of mipmap                     }
  467.         offset:                    UInt32;                                    {  Offset from image base to this mipmap  }
  468.     END;
  469.  
  470.     TQ3MipmapPtr = ^TQ3Mipmap;
  471.     TQ3Mipmap = RECORD
  472.         image:                    TQ3StorageObject;                        {  Data containing the texture map and       }
  473.                                                                         {  if (useMipmapping==kQ3True) the           }
  474.                                                                         {  mipmap data                               }
  475.         useMipmapping:            TQ3Boolean;                                {  True if mipmapping should be used       }
  476.                                                                         {  and all mipmaps have been provided     }
  477.         pixelType:                TQ3PixelType;
  478.         bitOrder:                TQ3Endian;
  479.         byteOrder:                TQ3Endian;
  480.         reserved:                UInt32;                                    {  leave NULL for next version              }
  481.         mipmaps:                ARRAY [0..31] OF TQ3MipmapImage;        {  The actual number of mipmaps is determined from the size of the first mipmap  }
  482.     END;
  483.  
  484.  
  485. {*****************************************************************************
  486.  **                                                                             **
  487.  **                        Higher dimension quantities                             **
  488.  **                                                                             **
  489.  ****************************************************************************}
  490.     TQ3AreaPtr = ^TQ3Area;
  491.     TQ3Area = RECORD
  492.         min:                    TQ3Point2D;
  493.         max:                    TQ3Point2D;
  494.     END;
  495.  
  496.     TQ3PlaneEquationPtr = ^TQ3PlaneEquation;
  497.     TQ3PlaneEquation = RECORD
  498.         normal:                    TQ3Vector3D;
  499.         constant:                Single;
  500.     END;
  501.  
  502.     TQ3BoundingBoxPtr = ^TQ3BoundingBox;
  503.     TQ3BoundingBox = RECORD
  504.         min:                    TQ3Point3D;
  505.         max:                    TQ3Point3D;
  506.         isEmpty:                TQ3Boolean;
  507.     END;
  508.  
  509.     TQ3BoundingSpherePtr = ^TQ3BoundingSphere;
  510.     TQ3BoundingSphere = RECORD
  511.         origin:                    TQ3Point3D;
  512.         radius:                    Single;
  513.         isEmpty:                TQ3Boolean;
  514.     END;
  515.  
  516. {
  517.  *    The TQ3ComputeBounds flag passed to StartBoundingBox or StartBoundingSphere
  518.  *    calls in the View. It's a hint to the system as to how it should 
  519.  *    compute the bbox of a shape:
  520.  *
  521.  *    kQ3ComputeBoundsExact:    
  522.  *        Vertices of shapes are transformed into world space and
  523.  *        the world space bounding box is computed from them.  Slow!
  524.  *    
  525.  *    kQ3ComputeBoundsApproximate: 
  526.  *        A local space bounding box is computed from a shape's
  527.  *        vertices.  This bbox is then transformed into world space,
  528.  *        and its bounding box is taken as the shape's approximate
  529.  *        bbox.  Fast but the bbox is larger than optimal.
  530.  }
  531.     TQ3ComputeBounds             = LONGINT;
  532. CONST
  533.     kQ3ComputeBoundsExact        = {TQ3ComputeBounds}0;
  534.     kQ3ComputeBoundsApproximate    = {TQ3ComputeBounds}1;
  535.  
  536.  
  537. {*****************************************************************************
  538.  **                                                                             **
  539.  **                            Object System Types                                 **
  540.  **                                                                             **
  541.  ****************************************************************************}
  542.  
  543.  
  544. TYPE
  545.     TQ3XObjectClass = ^LONGINT;
  546.     TQ3XMethodType                        = UInt32;
  547. {
  548.  * Object methods
  549.  }
  550.  *  Return true from the metahandler if this 
  551.  *  object can be submitted in a rendering loop 
  552.  }
  553. {$IFC TYPED_FUNCTION_POINTERS}
  554.     TQ3XFunctionPointer = PROCEDURE; C;
  555. {$ELSEC}
  556.     TQ3XFunctionPointer = ProcPtr;
  557. {$ENDC}
  558.  
  559. {$IFC TYPED_FUNCTION_POINTERS}
  560.     TQ3XMetaHandler = FUNCTION(methodType: TQ3XMethodType): TQ3XFunctionPointer; C;
  561. {$ELSEC}
  562.     TQ3XMetaHandler = ProcPtr;
  563. {$ENDC}
  564.  
  565. {
  566.  * MetaHandler:
  567.  *        When you give a metahandler to QuickDraw 3D, it is called multiple 
  568.  *        times to build method tables, and then is thrown away. You are 
  569.  *        guaranteed that your metahandler will never be called again after a 
  570.  *        call that was passed a metahandler returns.
  571.  *
  572.  *        Your metahandler should contain a switch on the methodType passed to it
  573.  *        and should return the corresponding method as an TQ3XFunctionPointer.
  574.  *
  575.  *        IMPORTANT: A metaHandler MUST always "return" a value. If you are
  576.  *        passed a methodType that you do not understand, ALWAYS return NULL.
  577.  *
  578.  *        These types here are prototypes of how your functions should look.
  579.  }
  580. {$IFC TYPED_FUNCTION_POINTERS}
  581.     TQ3XObjectUnregisterMethod = FUNCTION(objectClass: TQ3XObjectClass): TQ3Status; C;
  582. {$ELSEC}
  583.     TQ3XObjectUnregisterMethod = ProcPtr;
  584. {$ENDC}
  585.  
  586. {
  587.  * See QD3DIO.h for the IO method types: 
  588.  *        ObjectReadData, ObjectTraverse, ObjectWrite
  589.  }
  590.  
  591. {*****************************************************************************
  592.  **                                                                             **
  593.  **                                Set Types                                     **
  594.  **                                                                             **
  595.  ****************************************************************************}
  596.     TQ3ElementType                        = LONGINT;
  597.  
  598. CONST
  599.     kQ3ElementTypeNone            = 0;
  600.     kQ3ElementTypeUnknown        = 32;
  601.     kQ3ElementTypeSet            = 33;
  602.  
  603.  
  604.  *    kQ3ElementTypeUnknown is a TQ3Object. 
  605.  *    
  606.  *        Do Q3Set_Add(s, ..., &obj) or Q3Set_Get(s, ..., &obj);
  607.  *        
  608.  *        Note that the object is always referenced when copying around. 
  609.  *        
  610.  *        Generally, it is an Unknown object, a Group of Unknown objects, or a 
  611.  *        group of other "objects" which have been found in the metafile and
  612.  *        have no attachment method to their parent. Be prepared to handle
  613.  *        any or all of these cases if you actually access the set on a shape.
  614.  *
  615.  *    kQ3ElementTypeSet is a TQ3SetObject. 
  616.  *    
  617.  *        Q3Shape_GetSet(s,&o) is eqivalent to 
  618.  *            Q3Shape_GetElement(s, kQ3ElementTypeSet, &o)
  619.  *            
  620.  *        Q3Shape_SetSet(s,o)  is eqivalent to 
  621.  *            Q3Shape_SetElement(s, kQ3ElementTypeSet, &o)
  622.  *    
  623.  *        Note that the object is always referenced when copying around. 
  624.  *        
  625.  *    See the note below about the Set and Shape changes.
  626.  }
  627.  
  628. {*****************************************************************************
  629.  **                                                                             **
  630.  **                            Object System Macros                             **
  631.  **                                                                             **
  632.  ****************************************************************************}
  633. {*****************************************************************************
  634.  **                                                                             **
  635.  **                                Object Types                                 **
  636.  **                                                                             **
  637.  ****************************************************************************}
  638. {
  639.  * Note:    a call to Q3Foo_GetType will return a value kQ3FooTypeBar
  640.  *            e.g. Q3Shared_GetType(object) returns kQ3SharedTypeShape, etc.
  641.  }
  642.  
  643.     kQ3ObjectTypeInvalid        = 0;
  644.     kQ3ObjectTypeView            = 'view';
  645.     kQ3ObjectTypeElement        = 'elmn';
  646.     kQ3ElementTypeAttribute        = 'eatt';
  647.     kQ3ObjectTypePick            = 'pick';
  648.     kQ3PickTypeWindowPoint        = 'pkwp';
  649.     kQ3PickTypeWindowRect        = 'pkwr';
  650.     kQ3ObjectTypeShared            = 'shrd';
  651.     kQ3SharedTypeRenderer        = 'rddr';
  652.     kQ3RendererTypeWireFrame    = 'wrfr';
  653.     kQ3RendererTypeGeneric        = 'gnrr';
  654.     kQ3RendererTypeInteractive    = 'ctwn';
  655.     kQ3SharedTypeShape            = 'shap';
  656.     kQ3ShapeTypeGeometry        = 'gmtr';
  657.     kQ3GeometryTypeBox            = 'box ';
  658.     kQ3GeometryTypeGeneralPolygon = 'gpgn';
  659.     kQ3GeometryTypeLine            = 'line';
  660.     kQ3GeometryTypeMarker        = 'mrkr';
  661.     kQ3GeometryTypePixmapMarker    = 'mrkp';
  662.     kQ3GeometryTypeMesh            = 'mesh';
  663.     kQ3GeometryTypeNURBCurve    = 'nrbc';
  664.     kQ3GeometryTypeNURBPatch    = 'nrbp';
  665.     kQ3GeometryTypePoint        = 'pnt ';
  666.     kQ3GeometryTypePolygon        = 'plyg';
  667.     kQ3GeometryTypePolyLine        = 'plyl';
  668.     kQ3GeometryTypeTriangle        = 'trng';
  669.     kQ3GeometryTypeTriGrid        = 'trig';
  670.     kQ3GeometryTypeCone            = 'cone';
  671.     kQ3GeometryTypeCylinder        = 'cyln';
  672.     kQ3GeometryTypeDisk            = 'disk';
  673.     kQ3GeometryTypeEllipse        = 'elps';
  674.     kQ3GeometryTypeEllipsoid    = 'elpd';
  675.     kQ3GeometryTypePolyhedron    = 'plhd';
  676.     kQ3GeometryTypeTorus        = 'tors';
  677.     kQ3GeometryTypeTriMesh        = 'tmsh';
  678.     kQ3ShapeTypeShader            = 'shdr';
  679.     kQ3ShaderTypeSurface        = 'sush';
  680.     kQ3SurfaceShaderTypeTexture    = 'txsu';
  681.     kQ3ShaderTypeIllumination    = 'ilsh';
  682.     kQ3IlluminationTypePhong    = 'phil';
  683.     kQ3IlluminationTypeLambert    = 'lmil';
  684.     kQ3IlluminationTypeNULL        = 'nuil';
  685.     kQ3ShapeTypeStyle            = 'styl';
  686.     kQ3StyleTypeBackfacing        = 'bckf';
  687.     kQ3StyleTypeInterpolation    = 'intp';
  688.     kQ3StyleTypeFill            = 'fist';
  689.     kQ3StyleTypePickID            = 'pkid';
  690.     kQ3StyleTypeReceiveShadows    = 'rcsh';
  691.     kQ3StyleTypeHighlight        = 'high';
  692.     kQ3StyleTypeSubdivision        = 'sbdv';
  693.     kQ3StyleTypeOrientation        = 'ofdr';
  694.     kQ3StyleTypePickParts        = 'pkpt';
  695.     kQ3StyleTypeAntiAlias        = 'anti';
  696.     kQ3ShapeTypeTransform        = 'xfrm';
  697.     kQ3TransformTypeMatrix        = 'mtrx';
  698.     kQ3TransformTypeScale        = 'scal';
  699.     kQ3TransformTypeTranslate    = 'trns';
  700.     kQ3TransformTypeRotate        = 'rott';
  701.     kQ3TransformTypeRotateAboutPoint = 'rtap';
  702.     kQ3TransformTypeRotateAboutAxis = 'rtaa';
  703.     kQ3TransformTypeQuaternion    = 'qtrn';
  704.     kQ3TransformTypeReset        = 'rset';
  705.     kQ3ShapeTypeLight            = 'lght';
  706.     kQ3LightTypeAmbient            = 'ambn';
  707.     kQ3LightTypeDirectional        = 'drct';
  708.     kQ3LightTypePoint            = 'pntl';
  709.     kQ3LightTypeSpot            = 'spot';
  710.     kQ3ShapeTypeCamera            = 'cmra';
  711.     kQ3CameraTypeOrthographic    = 'orth';
  712.     kQ3CameraTypeViewPlane        = 'vwpl';
  713.     kQ3CameraTypeViewAngleAspect = 'vana';
  714.     kQ3ShapeTypeGroup            = 'grup';
  715.     kQ3GroupTypeDisplay            = 'dspg';
  716.     kQ3DisplayGroupTypeOrdered    = 'ordg';
  717.     kQ3DisplayGroupTypeIOProxy    = 'iopx';
  718.     kQ3GroupTypeLight            = 'lghg';
  719.     kQ3GroupTypeInfo            = 'info';
  720.     kQ3ShapeTypeUnknown            = 'unkn';
  721.     kQ3UnknownTypeText            = 'uktx';
  722.     kQ3UnknownTypeBinary        = 'ukbn';
  723.     kQ3ShapeTypeReference        = 'rfrn';
  724.     kQ3ReferenceTypeExternal    = 'rfex';
  725.     kQ3SharedTypeSet            = 'set ';
  726.     kQ3SetTypeAttribute            = 'attr';
  727.     kQ3SharedTypeDrawContext    = 'dctx';
  728.     kQ3DrawContextTypePixmap    = 'dpxp';
  729.     kQ3DrawContextTypeMacintosh    = 'dmac';
  730.     kQ3DrawContextTypeWin32DC    = 'dw32';
  731.     kQ3DrawContextTypeDDSurface    = 'ddds';
  732.     kQ3DrawContextTypeX11        = 'dx11';
  733.     kQ3SharedTypeTexture        = 'txtr';
  734.     kQ3TextureTypePixmap        = 'txpm';
  735.     kQ3TextureTypeMipmap        = 'txmm';
  736.     kQ3SharedTypeFile            = 'file';
  737.     kQ3SharedTypeStorage        = 'strg';
  738.     kQ3StorageTypeMemory        = 'mems';
  739.     kQ3MemoryStorageTypeHandle    = 'hndl';
  740.     kQ3StorageTypeUnix            = 'uxst';
  741.     kQ3UnixStorageTypePath        = 'unix';
  742.     kQ3StorageTypeMacintosh        = 'macn';
  743.     kQ3MacintoshStorageTypeFSSpec = 'macp';
  744.     kQ3StorageTypeWin32            = 'wist';
  745.     kQ3SharedTypeString            = 'strn';
  746.     kQ3StringTypeCString        = 'strc';
  747.     kQ3SharedTypeShapePart        = 'sprt';
  748.     kQ3ShapePartTypeMeshPart    = 'spmh';
  749.     kQ3MeshPartTypeMeshFacePart    = 'mfac';
  750.     kQ3MeshPartTypeMeshEdgePart    = 'medg';
  751.     kQ3MeshPartTypeMeshVertexPart = 'mvtx';
  752.     kQ3SharedTypeControllerState = 'ctst';
  753.     kQ3SharedTypeTracker        = 'trkr';
  754.     kQ3SharedTypeViewHints        = 'vwhn';
  755.     kQ3SharedTypeEndGroup        = 'endg';
  756.  
  757. {*****************************************************************************
  758.  **                                                                             **
  759.  **                            QuickDraw 3D System Routines                     **
  760.  **                                                                             **
  761.  ****************************************************************************}
  762. FUNCTION Q3Initialize: TQ3Status; C;
  763. FUNCTION Q3Exit: TQ3Status; C;
  764. FUNCTION Q3IsInitialized: TQ3Boolean; C;
  765. FUNCTION Q3GetVersion(VAR majorRevision: UInt32; VAR minorRevision: UInt32): TQ3Status; C;
  766. {
  767.  *  Q3GetReleaseVersion returns the release version number,
  768.  *  in the format of the first four bytes of a 'vers' resource
  769.  *  (e.g. 0x01518000 ==> 1.5.1 release).
  770.  }
  771. FUNCTION Q3GetReleaseVersion(VAR releaseRevision: UInt32): TQ3Status; C;
  772.  
  773. {*****************************************************************************
  774.  **                                                                             **
  775.  **                            ObjectClass Routines                             **
  776.  **                                                                             **
  777.  ****************************************************************************}
  778.  *  New object system calls to query the object system.
  779.  *
  780.  *  These comments to move to the stubs file before final release, they 
  781.  *  are here for documentation for developers using early seeds.
  782.  }
  783. {
  784.  *  Given a class name as a string return the associated class type for the 
  785.  *  class, may return kQ3Failure if the string representing the class is 
  786.  *  invalid.
  787.  }
  788. FUNCTION Q3ObjectHierarchy_GetTypeFromString(VAR objectClassString: TQ3ObjectClassNameString; VAR objectClassType: TQ3ObjectType): TQ3Status; C;
  789. {
  790.  *  Given a class type as return the associated string for the class name, 
  791.  *  may return kQ3Failure if the type representing the class is invalid.
  792.  }
  793. FUNCTION Q3ObjectHierarchy_GetStringFromType(objectClassType: TQ3ObjectType; VAR objectClassString: TQ3ObjectClassNameString): TQ3Status; C;
  794.  *  Return true if the class with this type is registered, false if not 
  795.  }
  796. FUNCTION Q3ObjectHierarchy_IsTypeRegistered(objectClassType: TQ3ObjectType): TQ3Boolean; C;
  797.  *  Return true if the class with this name is registered, false if not 
  798.  }
  799. FUNCTION Q3ObjectHierarchy_IsNameRegistered(objectClassName: ConstCStringPtr): TQ3Boolean; C;
  800. {
  801.  * TQ3SubClassData is used when querying the object system for
  802.  * the subclasses of a particular parent type:
  803.  }
  804.  
  805. TYPE
  806.     TQ3SubClassDataPtr = ^TQ3SubClassData;
  807.     TQ3SubClassData = RECORD
  808.         numClasses:                UInt32;                                    {  the # of subclass types found for a parent class  }
  809.         classTypes:                TQ3ObjectTypePtr;                        {  an array containing the class types  }
  810.     END;
  811.  
  812. {
  813.  *  Given a parent type and an instance of the TQ3SubClassData struct fill
  814.  *  it in with the number and class types of all of the subclasses immediately
  815.  *  below the parent in the class hierarchy.  Return kQ3Success to indicate no
  816.  *  errors occurred, else kQ3Failure.
  817.  *
  818.  *  NOTE:  This function will allocate memory for the classTypes array.  Be 
  819.  *    sure to call Q3ObjectClass_EmptySubClassData to free this memory up.
  820.  }
  821. FUNCTION Q3ObjectHierarchy_GetSubClassData(objectClassType: TQ3ObjectType; VAR subClassData: TQ3SubClassData): TQ3Status; C;
  822. {
  823.  *  Given an instance of the TQ3SubClassData struct free all memory allocated 
  824.  *    by the Q3ObjectClass_GetSubClassData call.
  825.  *
  826.  *  NOTE: This call MUST be made after a call to Q3ObjectClass_GetSubClassData
  827.  *  to avoid memory leaks.
  828.  }
  829. FUNCTION Q3ObjectHierarchy_EmptySubClassData(VAR subClassData: TQ3SubClassData): TQ3Status; C;
  830.  
  831. {*****************************************************************************
  832.  **                                                                             **
  833.  **                                Object Routines                                 **
  834.  **                                                                             **
  835.  ****************************************************************************}
  836. FUNCTION Q3Object_Dispose(object: TQ3Object): TQ3Status; C;
  837. FUNCTION Q3Object_Duplicate(object: TQ3Object): TQ3Object; C;
  838. FUNCTION Q3Object_Submit(object: TQ3Object; view: TQ3ViewObject): TQ3Status; C;
  839. FUNCTION Q3Object_IsDrawable(object: TQ3Object): TQ3Boolean; C;
  840. FUNCTION Q3Object_IsWritable(object: TQ3Object; theFile: TQ3FileObject): TQ3Boolean; C;
  841.  
  842. {*****************************************************************************
  843.  **                                                                             **
  844.  **                            Object Type Routines                             **
  845.  **                                                                             **
  846.  ****************************************************************************}
  847. FUNCTION Q3Object_GetType(object: TQ3Object): TQ3ObjectType; C;
  848. FUNCTION Q3Object_GetLeafType(object: TQ3Object): TQ3ObjectType; C;
  849. FUNCTION Q3Object_IsType(object: TQ3Object; theType: TQ3ObjectType): TQ3Boolean; C;
  850.  
  851. {*****************************************************************************
  852.  **                                                                             **
  853.  **                            Shared Object Routines                             **
  854.  **                                                                             **
  855.  ****************************************************************************}
  856. FUNCTION Q3Shared_GetType(sharedObject: TQ3SharedObject): TQ3ObjectType; C;
  857. FUNCTION Q3Shared_GetReference(sharedObject: TQ3SharedObject): TQ3SharedObject; C;
  858.  *    Q3Shared_IsReferenced
  859.  *        Returns kQ3True if there is more than one reference to sharedObject.
  860.  *        Returns kQ3False if there is ONE reference to sharedObject.
  861.  *    
  862.  *    This call is intended to allow applications and plug-in objects to delete
  863.  *    objects of which they hold THE ONLY REFERENCE. This is useful when
  864.  *    caching objects, etc.
  865.  *    
  866.  *    Although many may be tempted, DO NOT DO THIS:
  867.  *        while (Q3Shared_IsReferenced(foo)) ( Q3Object_Dispose(foo); )
  868.  *    
  869.  *    Your application will crash and no one will buy it. Chapter 11 is 
  870.  *    never fun (unless you short the stock). Thanks.
  871.  }
  872. FUNCTION Q3Shared_IsReferenced(sharedObject: TQ3SharedObject): TQ3Boolean; C;
  873. {
  874.  *    Q3Shared_GetEditIndex
  875.  *        Returns the "serial number" of sharedObject. Usefuly for caching 
  876.  *        object information. Returns 0 on error.
  877.  *        
  878.  *        Hold onto this number to determine if an object has changed since you
  879.  *        last built your caches... To validate, do:
  880.  *        
  881.  *        if (Q3Shared_GetEditIndex(foo) == oldFooEditIndex) (
  882.  *            // Cache is valid
  883.  *        ) else (
  884.  *            // Cache is invalid
  885.  *            RebuildSomeSortOfCache(foo);
  886.  *            oldFooEditIndex = Q3Shared_GetEditIndex(foo);
  887.  *        )
  888.  }
  889. FUNCTION Q3Shared_GetEditIndex(sharedObject: TQ3SharedObject): UInt32; C;
  890. {
  891.  *    Q3Shared_Edited
  892.  *        Bumps the "serial number" of sharedObject to a different value. This
  893.  *        call is intended to be used solely from a plug-in object which is 
  894.  *        shared. Call this whenever your private instance data changes.
  895.  *        
  896.  *        Returns kQ3Failure iff sharedObject is not a shared object, OR
  897.  *            QuickDraw 3D isn't initialized.
  898.  }
  899. FUNCTION Q3Shared_Edited(sharedObject: TQ3SharedObject): TQ3Status; C;
  900.  
  901. {*****************************************************************************
  902.  **                                                                             **
  903.  **                                Shape Routines                                 **
  904.  **                                                                             **
  905.  ****************************************************************************}
  906. {
  907.  *    QuickDraw 3D 1.5 Note:
  908.  *
  909.  *    Shapes and Sets are now (sort of) polymorphic.
  910.  *
  911.  *        You may call Q3Shape_Foo or Q3Set_Foo on a shape or a set.
  912.  *        The following calls are identical, in implementation:
  913.  *
  914.  *            Q3Shape_GetElement            =    Q3Set_Get
  915.  *            Q3Shape_AddElement            =    Q3Set_Add
  916.  *            Q3Shape_ContainsElement        =    Q3Set_Contains
  917.  *            Q3Shape_GetNextElementType    =    Q3Set_GetNextElementType
  918.  *            Q3Shape_EmptyElements        =    Q3Set_Empty
  919.  *            Q3Shape_ClearElement        =    Q3Set_Clear
  920.  *
  921.  *    All of these calls accept a shape or a set as their first parameter.
  922.  *
  923.  *    The Q3Shape_GetSet and Q3ShapeSetSet calls are implemented via a new
  924.  *    element type kQ3ElementTypeSet. See the note above about 
  925.  *    kQ3ElementTypeSet;
  926.  *
  927.  *    It is important to note that the new Q3Shape_...Element... calls do not
  928.  *    create a set on a shape and then add the element to it. This data is
  929.  *    attached directly to the shape. Therefore, it is possible for an element
  930.  *    to exist on a shape without a set existing on it as well. 
  931.  *
  932.  *    In your application, if you attach an element to a shape like this:
  933.  *        (this isn't checking for errors for simplicity)
  934.  *
  935.  *        set = Q3Set_New();
  936.  *        Q3Set_AddElement(set, kMyElemType, &data);
  937.  *        Q3Shape_SetSet(shape, set);
  938.  *
  939.  *    You should retrieve it in the same manner:
  940.  *
  941.  *        Q3Shape_GetSet(shape, &set);
  942.  *        if (Q3Set_Contains(set, kMyElemType) == kTrue) (
  943.  *            Q3Set_Get(set, kMyElemType, &data);
  944.  *        )
  945.  *
  946.  *    Similarly, if you attach data to a shape with the new calls:
  947.  *
  948.  *        Q3Shape_AddElement(shape, kMyElemType, &data);
  949.  *
  950.  *    You should retrieve it in the same manner:
  951.  *
  952.  *        if (Q3Shape_ContainsElement(set, kMyElemType) == kTrue) (
  953.  *            Q3Shape_GetElement(set, kMyElemType, &data);
  954.  *        )
  955.  *
  956.  *    This really becomes an issue when dealing with version 1.0 and version 1.1 
  957.  *    metafiles.
  958.  *
  959.  *    When attempting to find a particular element on a shape, you should
  960.  *    first check with Q3Shape_GetNextElementType or Q3Shape_GetElement, then,
  961.  *    Q3Shape_GetSet(s, &set) (or Q3Shape_GetElement(s, kQ3ElementTypeSet, &set))
  962.  *    and then Q3Shape_GetElement(set, ...).
  963.  *
  964.  *    In terms of implementation, Q3Shape_SetSet and Q3Shape_GetSet should only be
  965.  *    used for sets of information that are shared among multiple shapes.
  966.  *    
  967.  *    Q3Shape_AddElement, Q3Shape_GetElement, etc. calls should only be used
  968.  *    for elements that are unique for a particular shape.
  969.  *    
  970.  }
  971. FUNCTION Q3Shape_GetType(shape: TQ3ShapeObject): TQ3ObjectType; C;
  972. FUNCTION Q3Shape_GetSet(shape: TQ3ShapeObject; VAR theSet: TQ3SetObject): TQ3Status; C;
  973. FUNCTION Q3Shape_SetSet(shape: TQ3ShapeObject; theSet: TQ3SetObject): TQ3Status; C;
  974. FUNCTION Q3Shape_AddElement(shape: TQ3ShapeObject; theType: TQ3ElementType; data: UNIV Ptr): TQ3Status; C;
  975. FUNCTION Q3Shape_GetElement(shape: TQ3ShapeObject; theType: TQ3ElementType; data: UNIV Ptr): TQ3Status; C;
  976. FUNCTION Q3Shape_ContainsElement(shape: TQ3ShapeObject; theType: TQ3ElementType): TQ3Boolean; C;
  977. FUNCTION Q3Shape_GetNextElementType(shape: TQ3ShapeObject; VAR theType: TQ3ElementType): TQ3Status; C;
  978. FUNCTION Q3Shape_EmptyElements(shape: TQ3ShapeObject): TQ3Status; C;
  979. FUNCTION Q3Shape_ClearElement(shape: TQ3ShapeObject; theType: TQ3ElementType): TQ3Status; C;
  980.  
  981. {*****************************************************************************
  982.  **                                                                             **
  983.  **                            Color Table Routines                             **
  984.  **                                                                             **
  985.  ****************************************************************************}
  986. FUNCTION Q3Bitmap_Empty(VAR bitmap: TQ3Bitmap): TQ3Status; C;
  987. FUNCTION Q3Bitmap_GetImageSize(width: UInt32; height: UInt32): UInt32; C;
  988.  
  989.  
  990. {$ALIGN RESET}
  991. {$POP}
  992.  
  993. {$SETC UsingIncludes := QD3DIncludes}
  994.  
  995. {$ENDC} {__QD3D__}
  996.  
  997. {$IFC NOT UsingIncludes}
  998.  END.
  999. {$ENDC}
  1000.